<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <button>赞(1)</button>
    <button>赞(1)</button>
    <button>赞(1)</button>
    <button>赞(1)</button>
    <script>
        // 闭包缓存数据
        function getValue() {
            var value = 5;
            return function () {
                //每一次点击的时候,都应该改变当前点击按钮的value值
                this.innerHTML = '赞(' + (value) + ')';
            }
        }
        // 获取所有按钮
        var btnObjs = document.getElementsByTagName('button');
        // 循环遍历每个按钮，注册点击事件
        for (var i = 0; i < btnObjs.length; i++) {
            // 注册事件
            btnObjs[i].onclick = getValue();
        }
    </script>
</body>

</html>